-
Notifications
You must be signed in to change notification settings - Fork 3.3k
fix(kb): removed filename constraint from knowledgebase doc names #1527
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Greptile Overview
Summary
This PR removes filename validation constraints from the knowledge base document creation tool in the Sim platform. The change eliminates restrictions on special characters (<>:"/\|?*) that were previously prevented in document names when creating knowledge base documents.The original validation was designed around filesystem naming conventions, but since the Sim knowledge base stores document names directly in the database rather than creating actual files, these constraints were unnecessarily restrictive. The system maintains document metadata in the database, making filesystem-specific character limitations irrelevant to the application's functionality.
This change enhances user experience by providing more flexibility in document naming while maintaining essential constraints like the 255-character length limit, which likely corresponds to database field limitations. The modification is located in the knowledge base tool's document creation functionality, specifically in the parameter validation logic.
Important Files Changed
Changed Files
| Filename | Score | Overview |
|---|---|---|
| apps/sim/tools/knowledge/create_document.ts | 4/5 | Removed special character validation regex for document names, allowing more flexible naming |
Confidence score: 4/5
- This PR is safe to merge with minimal risk as it removes unnecessary validation constraints
- Score reflects a straightforward change that improves usability without introducing technical debt or breaking functionality
- Pay attention to apps/sim/tools/knowledge/create_document.ts to ensure the remaining validation logic is sufficient
Sequence Diagram
sequenceDiagram
participant User
participant API as "Sim API"
participant KnowledgeService as "Knowledge Service"
participant Database as "Database"
participant FileProcessor as "File Processor"
User->>API: "POST /api/knowledge/{knowledgeBaseId}/documents"
Note over User,API: Request contains: name, content, tags
API->>API: "Validate document name length (≤255 chars)"
API->>API: "Validate content size (≤1MB)"
API->>API: "Encode content to base64 data URI"
API->>KnowledgeService: "Create document with processing options"
Note over API,KnowledgeService: Includes chunkSize: 1024, overlap: 200
KnowledgeService->>Database: "Store document metadata"
Database-->>KnowledgeService: "Return document ID"
KnowledgeService->>FileProcessor: "Process document chunks"
FileProcessor-->>KnowledgeService: "Return processed chunks"
KnowledgeService-->>API: "Return creation result"
API->>API: "Transform response with document details"
API-->>User: "Return success with document ID and metadata"
1 file reviewed, no comments
|
1 Job Failed: CI / Test and Build / Test and Build failed on "Build application" |
Summary
removed filename constraint from knowledgebase doc names, previously we had some constraints to the filename that are not hard restraints, since we store the file name as-is in the db
Type of Change
Testing
Manually.
Checklist